--法术狙击
local fashujuji = fk.CreateSkill {
    name = "mcdh_fashujuji"
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

fashujuji:addEffect(fk.TargetConfirmed,{
    can_trigger = function(self, event, target, player, data)
        return  player:hasSkill(self) and player:inMyAttackRange(target) and data.card.type == Card.TypeTrick and player:usedSkillTimes(self.name,Player.HistoryTurn) == 0
    end,
    on_cost = function(self, event, target, player, data)
        local room= player.room
        return #lib.askForPublicCard(room,player,player,1,1,self.name,true,"#mcdh_fashujuji:"..target.id,".|.|^(diamond)")~= 0
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:setPlayerMark(target,"@@mcdh_fashujuji-turn",1)
    end,
})


fashujuji:addEffect(fk.CardUsing,{
    can_refresh = function(self, event, target, player, data)
        return player == target and player:getMark("@@mcdh_fashujuji-turn") ~= 0
    end,
    on_refresh = function(self, event, target, player, data)
        local room = player.room
        room:setPlayerMark(target,"@@mcdh_fashujuji-turn",0)
        data:removeAllTargets()
    end
})

Fk:loadTranslationTable {
    ["mcdh_fashujuji"] = "法术狙击",
    [":mcdh_fashujuji"] = "每回合限一次，你攻击范围内的角色成为锦囊牌的目标后，你可以明置一张非♦牌，令其本回合使用的下一张牌无效（取消所有目标）。",
    ["#mcdh_fashujuji"] = "法术狙击:明置一张非♦牌，令 %src 本回合使用的下一张牌无效",
    ["@@mcdh_fashujuji-turn"] = "法术狙击"
}

return fashujuji